Skip to content

fix: update comparison #40953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

stefanfreitag
Copy link
Contributor

@stefanfreitag stefanfreitag commented Jan 15, 2025

Description

As described in #40580 updates to the value of running_mode_auto_stop_timeout_in_minutes in the resource aws_workspaces_workspace are not forwarded to the AWS Go SDK v2.

Example configuration of the resource:

resource "aws_workspaces_workspace" "workspace" {
  directory_id = "d-2783a367e8"
  bundle_id    = "wsb-8ry31mu7v"
  user_name    = "john.johnson"

  root_volume_encryption_enabled = true
  user_volume_encryption_enabled = true
  volume_encryption_key          = "arn:aws:kms:us-east-1:012345678912:key/05e668b8-debd-9829-8e18-ad62a787863f"

  workspace_prooperties {
    compute_type_name                 = STANDARD
    root_volume_size_gib              = 80
    user_volume_size_gib              = 10
    running_mode                      = "AUTO_STOP"
    running_mode_auto_stop_in_minutes = 120
  }
}

running_mode is set to "AUTO_STOP", so that the provider should allow updated to running_mode_auto_stop_in_minutes.

In the debug logs of a terraform apply one can actually find below line

2025-01-02T19:35:22.800+0100 [DEBUG] provider.terraform-provider-aws_v5.81.0_x5: [DEBUG] Property running_mode_auto_stop_timeout_in_minutes makes sense only for AUTO_STOP running mode

originating from this source code.

It seems to be the case that a type conversion to string is missing in this code snippet

if d.Get("workspace_properties.0.running_mode") != types.RunningModeAutoStop {
	log.Printf("[DEBUG] Property running_mode_auto_stop_timeout_in_minutes makes sense only for AUTO_STOP running mode")
	return nil
}

types.RunningModeAutoStop should read string(types.RunningModeAutoStop)

Relations

Closes #40580
Relates #32346

References

Output from Acceptance Testing

I am not 100% sure what to add here. I think it should be something like below for running all tests related to workspaces

% make testacc TESTS=TestAccWorkSpaces_serial PKG=workspaces

On my end I executed the test testAccWorkspace_workspaceProperties_runningModeAutoStopTimeoutInMinutes, but not other tests/ the whole "suite" because of costs.
Please let me know if that`s fine from your end.

Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added service/workspaces Issues and PRs that pertain to the workspaces service. needs-triage Waiting for first response or review from a maintainer. labels Jan 15, 2025
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 16, 2025
@github-actions github-actions bot added the tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. label Jan 21, 2025
@stefanfreitag stefanfreitag marked this pull request as ready for review January 21, 2025 19:08
@stefanfreitag stefanfreitag requested a review from a team as a code owner January 21, 2025 19:08
@stefanfreitag stefanfreitag deleted the b-aws_workspaces_workspace-fix_auto_stop_minutes_update branch March 29, 2025 19:54
Copy link

Warning

This Issue has been closed, meaning that any additional comments are much easier for the maintainers to miss. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@stefanfreitag stefanfreitag restored the b-aws_workspaces_workspace-fix_auto_stop_minutes_update branch March 30, 2025 18:12
@stefanfreitag stefanfreitag reopened this Mar 30, 2025
@stefanfreitag
Copy link
Contributor Author

Hi all,
accidentally deleted the branch during clean up activities. This action closed the pull request.

Restored the branch and re-opened the PR.

@github-actions github-actions bot added size/M Managed by automation to categorize the size of a PR. external-maintainer Contribution from a trusted external contributor. labels Mar 31, 2025
@jar-b jar-b added the regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. label Mar 31, 2025
@jar-b jar-b self-assigned this Mar 31, 2025
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Mar 31, 2025
Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

% make testacc PKG=workspaces TESTS="TestAccWorkSpaces_serial/Workspace/workspaceProperties_runningModeAutoStopTimeoutInMinutes"
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/workspaces/... -v -count 1 -parallel 20 -run='TestAccWorkSpaces_serial/Workspace/workspaceProperties_runningModeAutoStopTimeoutInMinutes'  -timeout 360m -vet=off
2025/03/31 15:31:49 Initializing Terraform AWS Provider...
=== RUN   TestAccWorkSpaces_serial
=== PAUSE TestAccWorkSpaces_serial
=== CONT  TestAccWorkSpaces_serial
=== RUN   TestAccWorkSpaces_serial/Workspace
=== RUN   TestAccWorkSpaces_serial/Workspace/workspaceProperties_runningModeAutoStopTimeoutInMinutes
--- PASS: TestAccWorkSpaces_serial (1738.33s)
    --- PASS: TestAccWorkSpaces_serial/Workspace (1738.33s)
        --- PASS: TestAccWorkSpaces_serial/Workspace/workspaceProperties_runningModeAutoStopTimeoutInMinutes (1738.33s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/workspaces 1744.868s

@jar-b
Copy link
Member

jar-b commented Mar 31, 2025

Thanks for the detailed investigation and fix, @stefanfreitag! 👍

@jar-b jar-b merged commit b92bb51 into hashicorp:main Apr 1, 2025
37 checks passed
Copy link

github-actions bot commented Apr 1, 2025

Warning

This Issue has been closed, meaning that any additional comments are much easier for the maintainers to miss. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.94.0 milestone Apr 1, 2025
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Apr 3, 2025
Copy link

github-actions bot commented Apr 3, 2025

This functionality has been released in v5.94.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. external-maintainer Contribution from a trusted external contributor. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/workspaces Issues and PRs that pertain to the workspaces service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: aws_workspaces_workspace running_mode_auto_stop_timeout_in_minutes not updating
4 participants